<!--
 * @Description: description
 * @version: 0.1
 * @Author: youhuimin
 * @Date: 2021-08-24 09:18:26
 * @LastEditors: youhuimin
 * @LastEditTime: 2021-08-31 15:04:25
 * @FilePath: \xdeas-user-web\src\components\select_user.vue
-->
<template>
    <div class="w100p h100p relative" :id="id">
        <a-select
            :getPopupContainer="getContainer"
            :mode="form.allow_multiple ? 'multiple' : 'default'"
            v-model="source"
            show-search
            allowClear
            :placeholder="configInfo.placeholder"
            style="width: 100%"
            :optionFilterProp="'children'"
            @change="changValue"
        >
            <a-select-option  v-for="item in userList" :value="item.currentUserDTO[idkey]" :key="item.currentUserDTO[idkey]">
                {{ item.currentUserDTO.nickName }}
            </a-select-option>
        </a-select>
    </div>
</template>

<script>
import global  from "@/assets/js/global";
export default {
    name: "select_user",
    props:{
        config: {
            // 组件的配置项
            type: Object,
            default() {
                return {};
            },
        },
        source:{

        },
        idkey:{
            // 默认是ID,需要使用accountId需要传值进来
            type:String,
            default:'id'
        }

    },
    beforeMount(){
        this.configInfo = { ...this.configInfo, ...this.config };
        this.getList();
    },
    mounted() {
    },
    data(){
        return{
            id:global.getRandomId(),
            configInfo: {
                placeholder: "请选择成员",
                maxTagCount: 9999,
                maxTagPlaceholder: () => {
                    return `已选择${this.form.values.length}人`;
                },
            },
            form: {
                allow_multiple: true,
                values: [],
            },
            userList:[],
        }
    },
    methods:{
        getList() {

            this.userList = [{
                "account": "13798182874",
                "allowBusiness": 1,
                "appBoundOrgId": "153796267909058560",
                "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png",
                "category": "预留",
                "createTimeDb": "2021-01-04 17:57:29",
                "currentUserDTO": {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "153796268538204160", "nickName": "王琦a有个车间工程师主管", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "empty": false,
                "id": "115510501659643904",
                "lastLoginTime": "2021-09-29 18:05",
                "mobile": "13798182874",
                "no": "6",
                "organizationNames": "团队已解散,团队已解散,团队已解散,个人用户,430回归,团队已解散,团队已解散,团队已解散,团队已解散,",
                "parentId": "0",
                "realName": "你爹2222222",
                "roleList": [{"accountId": "115510501659643904", "roleCode": "app_v2Admin", "roleDefaultRole": 1, "roleId": "20110315072342068", "roleName": "团队管理员"}],
                "showBoundOrgId": "153796267909058560",
                "showUserDTO": {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "153796268538204160", "nickName": "王琦a有个车间工程师主管", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "state": 0,
                "uniqueNickName": "74王琦",
                "userDTOList": [{"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "121667165530099712", "nickName": "测试人员！", "organizationId": "121667165278441472", "organizationName": "团队已解散", "state": 0}, {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "125987904555061248", "nickName": "你爹", "organizationId": "125987688967835648", "organizationName": "团队已解散", "state": 0}, {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "121664901490937856", "nickName": "测试人员！", "organizationId": "121664901218308096", "organizationName": "团队已解散", "state": 0}, {
                    "accountId": "115510501659643904",
                    "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png",
                    "gender": 0,
                    "id": "115510502490116096",
                    "nickName": "测试人员！1",
                    "organizationId": "2008151146301737",
                    "organizationIsVip": true,
                    "organizationName": "个人用户",
                    "organizationOwnCode": "F5EL2P32",
                    "state": 1,
                    "workMobile": "13798182874"
                }, {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "153796268538204160", "nickName": "王琦a有个车间工程师主管", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1}, {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "115511287303114752", "nickName": "测试人员！", "organizationId": "115511286699134976", "organizationName": "团队已解散", "state": 0}, {
                    "accountId": "115510501659643904",
                    "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png",
                    "gender": 0,
                    "id": "153164219078938624",
                    "nickName": "王琦74",
                    "organizationId": "143292436918046720",
                    "organizationName": "团队已解散",
                    "state": 0
                }, {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "121914951597035520", "nickName": "测试人员！", "organizationId": "121914951236325376", "organizationName": "团队已解散", "state": 0}, {"accountId": "115510501659643904", "avatar": "https://oss.xdeas.com.cn//avatar/xdeas-avatar-16.png", "gender": 0, "id": "123439540642779136", "nickName": "你咩", "organizationId": "123435055027589120", "organizationName": "团队已解散", "state": 0}]
            }, {
                "account": "15018753353",
                "allowBusiness": 1,
                "appBoundOrgId": "153796267909058560",
                "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                "category": "预留",
                "createTimeDb": "2021-04-17 00:03:50",
                "currentUserDTO": {"accountId": "152566259219697664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "153799347438358528", "nickName": "王琦5353", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "empty": false,
                "id": "152566259219697664",
                "lastLoginTime": "2021-09-29 23:34",
                "mobile": "15018753353",
                "no": "1",
                "organizationNames": "个人用户,团队已解散,430回归,",
                "parentId": "0",
                "realName": "15018753353",
                "roleList": [{"accountId": "152566259219697664", "roleCode": "businessManage", "roleDefaultRole": 1, "roleId": "20110316520814250", "roleName": "管理员"}],
                "showBoundOrgId": "153796267909058560",
                "showUserDTO": {"accountId": "152566259219697664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "153799347438358528", "nickName": "王琦5353", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "state": 0,
                "uniqueNickName": "王琦",
                "userDTOList": [{"accountId": "152566259219697664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "152566259622350848", "nickName": "15018753353", "organizationId": "2008151146301737", "organizationIsVip": true, "organizationName": "个人用户", "organizationOwnCode": "F5EL2P32", "state": 1, "workMobile": "15018753353"}, {"accountId": "152566259219697664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "152566302815293440", "nickName": "王琦53", "organizationId": "143292436918046720", "organizationName": "团队已解散", "state": 0}, {
                    "accountId": "152566259219697664",
                    "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                    "gender": 0,
                    "id": "153799347438358528",
                    "nickName": "王琦5353",
                    "organizationId": "153796267909058560",
                    "organizationIsVip": true,
                    "organizationName": "430回归",
                    "organizationOwnCode": "SKY8QNGA",
                    "state": 1
                }]
            }, {
                "account": "13560127563",
                "allowBusiness": 1,
                "appBoundOrgId": "153796267909058560",
                "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                "category": "预留",
                "createTimeDb": "2021-03-30 10:11:13",
                "currentUserDTO": {"accountId": "146196128705024000", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "153878519460401152", "nickName": "Fang", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "empty": false,
                "id": "146196128705024000",
                "lastLoginTime": "2021-09-26 16:02",
                "mobile": "13560127563",
                "no": "2",
                "organizationNames": "个人用户,430回归,团队已解散,",
                "parentId": "0",
                "realName": "用户7563",
                "roleList": [{"accountId": "146196128705024000", "roleCode": "businessManage", "roleDefaultRole": 1, "roleId": "20110316520814250", "roleName": "管理员"}],
                "showBoundOrgId": "153796267909058560",
                "showUserDTO": {"accountId": "146196128705024000", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "153878519460401152", "nickName": "Fang", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "state": 0,
                "uniqueNickName": "房俊婷",
                "userDTOList": [{"accountId": "146196128705024000", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "146196128734384128", "nickName": "用户7563", "organizationId": "2008151146301737", "organizationIsVip": true, "organizationName": "个人用户", "organizationOwnCode": "F5EL2P32", "state": 1, "workMobile": "13560127563"}, {"accountId": "146196128705024000", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "153878519460401152", "nickName": "Fang", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1}, {
                    "accountId": "146196128705024000",
                    "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                    "gender": 0,
                    "id": "146196394015723520",
                    "nickName": "房俊婷",
                    "organizationId": "146196393797619712",
                    "organizationName": "团队已解散",
                    "state": 0
                }]
            }, {
                "account": "13798182901",
                "allowBusiness": 1,
                "appBoundOrgId": "153796267909058560",
                "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                "category": "预留",
                "createTimeDb": "2021-07-21 10:41:35",
                "currentUserDTO": {"accountId": "187153600768643072", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153625968021504", "nickName": "2901", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "empty": false,
                "id": "187153600768643072",
                "lastLoginTime": "2021-09-24 15:54",
                "mobile": "13798182901",
                "no": "4",
                "organizationNames": "个人用户,430回归,",
                "parentId": "0",
                "realName": "13798182901",
                "roleList": [{"accountId": "187153600768643072", "roleCode": "businessManage", "roleDefaultRole": 1, "roleId": "20110316520814250", "roleName": "管理员"}],
                "showBoundOrgId": "153796267909058560",
                "showUserDTO": {"accountId": "187153600768643072", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153625968021504", "nickName": "2901", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "state": 0,
                "uniqueNickName": "13798182901",
                "userDTOList": [{"accountId": "187153600768643072", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153600789614592", "nickName": "13798182901", "organizationId": "2008151146301737", "organizationIsVip": true, "organizationName": "个人用户", "organizationOwnCode": "F5EL2P32", "state": 1, "workMobile": "13798182901"}, {"accountId": "187153600768643072", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153625968021504", "nickName": "2901", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1}]
            }, {
                "account": "13172049019",
                "allowBusiness": 1,
                "appBoundOrgId": "153796267909058560",
                "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                "category": "预留",
                "createTimeDb": "2021-03-17 18:37:04",
                "currentUserDTO": {"accountId": "141612389500981248", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "155995266606960640", "nickName": "睁眼", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "empty": false,
                "id": "141612389500981248",
                "lastLoginTime": "2021-09-22 17:09",
                "mobile": "13172049019",
                "no": "3",
                "organizationNames": "430回归,团队已解散,个人用户,",
                "parentId": "0",
                "realName": "13172049019",
                "roleList": [],
                "showBoundOrgId": "153796267909058560",
                "showUserDTO": {"accountId": "141612389500981248", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "155995266606960640", "nickName": "睁眼", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "state": 0,
                "uniqueNickName": "132312",
                "userDTOList": [{"accountId": "141612389500981248", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "155995266606960640", "nickName": "睁眼", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1}, {"accountId": "141612389500981248", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "141615791920386048", "nickName": "13172049019", "organizationId": "141615791589036032", "organizationName": "团队已解散", "state": 0}, {
                    "accountId": "141612389500981248",
                    "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                    "gender": 0,
                    "id": "141612389534535680",
                    "nickName": "13172049019",
                    "organizationId": "2008151146301737",
                    "organizationIsVip": true,
                    "organizationName": "个人用户",
                    "organizationOwnCode": "F5EL2P32",
                    "state": 1,
                    "workMobile": "13172049019"
                }]
            }, {
                "account": "13798182903",
                "allowBusiness": 1,
                "appBoundOrgId": "153796267909058560",
                "avatar": "https://oss.xdeas.com.cn/avatar-0.png",
                "category": "预留",
                "createTimeDb": "2021-07-21 10:42:07",
                "currentUserDTO": {"accountId": "187153734663409664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153748731105280", "nickName": "2903", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "empty": false,
                "id": "187153734663409664",
                "lastLoginTime": "2021-09-28 16:37",
                "mobile": "13798182903",
                "no": "5",
                "organizationNames": "个人用户,430回归,",
                "parentId": "0",
                "realName": "13798182903",
                "roleList": [],
                "showBoundOrgId": "153796267909058560",
                "showUserDTO": {"accountId": "187153734663409664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153748731105280", "nickName": "2903", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1},
                "state": 0,
                "uniqueNickName": "13798182903",
                "userDTOList": [{"accountId": "187153734663409664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153734684381184", "nickName": "13798182903", "organizationId": "2008151146301737", "organizationIsVip": true, "organizationName": "个人用户", "organizationOwnCode": "F5EL2P32", "state": 1, "workMobile": "13798182903"}, {"accountId": "187153734663409664", "avatar": "https://oss.xdeas.com.cn/avatar-0.png", "gender": 0, "id": "187153748731105280", "nickName": "2903", "organizationId": "153796267909058560", "organizationIsVip": true, "organizationName": "430回归", "organizationOwnCode": "SKY8QNGA", "state": 1}]
            }]
            // this.$axios
            //     .get(this.$url.selectOrgAccountByOrganizationId, {
            //         params: {
            //             orgId: this.$store.state.user.info.currentUserDTO.organizationId,
            //         },
            //     })
            //     .then((data) => {
            //         this.userList = data.data;
            //     });
        },
        getContainer() {
            // 指定父级容器,解决滚动条滚动时,选择框跟着移动的问题
            return document.getElementById(this.id);
        },
        changValue(value){
            this.$emit('change',value)
        },
    },
}
</script>

<style scoped>

</style>